package com.fivestar.pmanager.core.service;

import com.fivestar.pmanager.core.base.BaseBean;
import com.fivestar.pmanager.core.base.BaseCommonParameterBean;
import com.fivestar.pmanager.core.exception.DMLNoRecordEffectedException;

public interface DirectService<T extends BaseBean>
{
    /**
     * Direct to create(No need to approve by another user) Note: should throw
     * DMLNoRecordEffectedException if operate failed. e.g. throw
     * StaleDataDMLNoRecordEffectedException
     * 
     * @param param - holder of every module
     * @throws DMLNoRecordEffectedException
     */
    int insert(T param,  BaseCommonParameterBean commonParam)
            throws DMLNoRecordEffectedException;


    /**
     * Direct to update(No need to approve by another user) Note: should throw
     * DMLNoRecordEffectedException if operate failed. e.g. throw
     * StaleDataDMLNoRecordEffectedException
     * 
     * @author liyue
     * @param param - holder of every module
     * @throws DMLNoRecordEffectedException
     */
    int update(T param, BaseCommonParameterBean commonParam)
            throws DMLNoRecordEffectedException;


    /**
     * Direct to update(No need to approve by another user) Note: should throw
     * DMLNoRecordEffectedException if operate failed. e.g. throw
     * StaleDataDMLNoRecordEffectedException
     * 
     * @author liyue
     * @param param - holder of every module
     * @throws DMLNoRecordEffectedException
     */
    int updateBySelective(T param, BaseCommonParameterBean commonParam) throws DMLNoRecordEffectedException;


    /**
     * Logic to delete(No need to approve by another user) Note: should throw
     * DMLNoRecordEffectedException if operate failed. e.g. throw
     * StaleDataDMLNoRecordEffectedException
     * 
     * @param param - holder of every module
     * @throws DMLConstraintException
     */
     int delete(T param, BaseCommonParameterBean commonParam)
            throws DMLNoRecordEffectedException;

    /**
     * Physics to delete(No need to approve by another user) Note: should throw
     * DMLNoRecordEffectedException if operate failed. e.g. throw
     * StaleDataDMLNoRecordEffectedException
     *
     * @param param - holder of every module
     * @throws DMLNoRecordEffectedException
     */
    int deletePhysics(T param, BaseCommonParameterBean commonParam)
            throws DMLNoRecordEffectedException;
    
    /**
     * 保存方法
     *
     * @throws DMLNoRecordEffectedException
     */
     void save(T param, BaseCommonParameterBean commonParam) throws DMLNoRecordEffectedException;
}
